<?php
require_once 'pages/TMSListPage.inc';

class TMSCommentsPage extends TMSListPage {
	public function http_Approve($id){
		$c = $this->Model->GetItem($id);
		$c->IsApproved = true;
		$this->Model->Save($c);
	}
	
	public function ItemApproveUrl(IItem $item){
		return $this->Url(null,'Approve',array('id'=>$item->ItemId()));
	}
	
	public function ActionUrls(IItem $item){
		$result = array();
		if (!$item->IsApproved){
			$result['Approve'] = $this->ItemApproveUrl($item);
			$result['Delete'] = $this->ItemDeleteUrl($item);
		}
		return $result;
	}
	
	public function __get($nm){
		switch ($nm){
			case 'CreateLink':return null;break;
			default:return parent::__get($nm);break;
		}
	}
}